FROM registry.cn-hangzhou.aliyuncs.com/last911/openresty-php7.4-swoole-root:latest
WORKDIR /data/wwwroot
COPY ["app/", "/data/wwwroot/app/"]
COPY ["bootstrap/", "/data/wwwroot/bootstrap/"]
COPY ["config/", "/data/wwwroot/config/"]
COPY ["database/", "/data/wwwroot/database/"]
COPY ["public/", "/data/wwwroot/public/"]
COPY ["resources/", "/data/wwwroot/resources/"]
COPY ["routes/", "/data/wwwroot/routes/"]
COPY ["sh/", "/data/wwwroot/sh/"]
COPY ["storage/", "/data/wwwroot/storage/"]
COPY ["tests/", "/data/wwwroot/tests/"]
# COPY ["vendor/", "/data/wwwroot/vendor/"]
COPY ["artisan", "composer.json", "package.json", "phpunit.xml", "server.php", "webpack.mix.js", "/data/wwwroot/"]
COPY ["www.conf", "/data/openresty/nginx/conf/vhosts/"]
COPY ["cron", "/var/spool/cron/crontabs/root"]
COPY ["env.sh", "/usr/bin/env.sh"]
COPY ["run.sh", "/usr/bin/run.sh"]
RUN \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    /data/php/bin/php -d memory_limit=-1 /data/php/bin/composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && \
    /data/php/bin/php -d memory_limit=-1 /data/php/bin/composer install && \
    /data/php/bin/php -d memory_limit=-1 /data/php/bin/composer dump-autoload -o && \
    chmod 0644 /var/spool/cron/crontabs/root && \
    crontab /var/spool/cron/crontabs/root
EXPOSE 80
CMD sh /usr/bin/env.sh > /data/wwwroot/.env && sh /usr/bin/run.sh
